from django.shortcuts import render

# Create your views here.

from rest_framework.generics import CreateAPIView, ListAPIView, UpdateAPIView, GenericAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response

from educations.models import Educations
from educations.serializers import EducationSerializer


class EducationView(CreateAPIView):
    # 需要实现学历的编辑，所有表查询，
    permission_classes = [IsAuthenticated]
    serializer_class = EducationSerializer




class EducationView1(UpdateAPIView):
    permission_classes = [IsAuthenticated]
    serializer_class = EducationSerializer

    def get(self, request):
        id = self.request.query_params["id"]
        education = Educations.objects.get(id=id)
        serializer = EducationSerializer(education)
        return Response(serializer.data)
